/*
 * @Description: 档案分类相关接口
 * @Author: Rfan
 * @Date: 2022-05-28 16:22:33
 * @LastEditTime: 2022-06-02 16:31:05
 */

import { configRequest } from '@/utils/request';
import type { IArchiveClassify } from '@/interfaces/archiveType';
import type { IPageQuery } from '@/interfaces/global';

// 查询档案分类列表
export interface IArchiveClassifyParams extends Partial<IArchiveClassify> {}

export function fetchArchiveClassify(data: IArchiveClassifyParams) {
  return configRequest({
    url: `/archive-classification/list`,
    method: 'post',
    data
  });
}

// 分页查询档案分类列表
export interface IArchiveClassifyByPageParams extends IPageQuery<IArchiveClassifyParams> {}

export function fetchArchiveClassifyByPage(data: IArchiveClassifyByPageParams) {
  return configRequest({
    url: `/archive-classification/page`,
    method: 'post',
    data
  });
}

// 新增档案分类
export function addArchiveClassify(data: Partial<IArchiveClassify>) {
  return configRequest({
    url: `/archive-classification/`,
    method: 'post',
    data
  });
}

// 编辑档案分类
export function editArchiveClassify(data: Partial<IArchiveClassify>) {
  return configRequest({
    url: `/archive-classification/`,
    method: 'put',
    data
  });
}

// 删除档案分类
export function deleteArchiveClassify(id: string) {
  return configRequest({
    url: `/archive-classification/${id}`,
    method: 'delete'
  });
}
